<%+header%>
<h2><a id="content" name="content"><%:Status%></a></h2>
<script>  //general function
	function getValue(ID)
	{
		return document.getElementById(ID).value;
	}
	function setDisplay(ID,type)
	{
		if(!type)
		{
			document.getElementById(ID).style.display="none";
		}
		else
		{
			document.getElementById(ID).style.display="inline";
		}
	}
	function setHTML(ID,STR)
	{
		document.getElementById(ID).innerHTML=STR;
	}
	function setValue(ID,val){
		document.getElementById(ID).value=val;
	}
</script>

<fieldset class="cbi-section">
	<table width="100%" cellspacing="10">
		<tr><td width="25%"><%:System State%>:</td><td  style="color:red" id="sysstate"></td></tr>
		<!--tr><td ><%:Attack State%>:</td><td  style="color:red" id="attackstate"></td></tr-->
		<tr><td ><%:Capturing State%>:</td><td  style="color:red" id="capturingstate"></td></tr>
		<tr><td ><%:Wireless Mode%>:</td><td  style="color:red" id="wifimode"></td></tr>
		<tr><td><%:Wireless SSID%>:</td><td  style="color:red" id="wifissid"></td></tr>
		<tr><td><%:Encryption Mode%>:</td><td  style="color:red" id="encryptionmode"></td></tr>
		<tr><td><%:Wireless Channel%>:</td><td  style="color:red" id="wirelesschannel"></td></tr>
		<tr><td ><%:Store Information%>:</td><td  style="color:red" id="storeinformation"></td></tr>
		<tr><td><%:Probe Management%>:</td><td  style="color:red" id="proeManagement"></td></tr>
	</table>

<script>

function setStatusValue(rval)
{
	setHTML("sysstate",rval.sysstate == "running" ? "<%:running%>":"<%:stop%>");
	//setHTML("attackstate",rval.attackstate);
	setHTML("capturingstate",rval.capturingstate == "cap" ? "<%:cap%>" : "<%:uncap%>" );
	setHTML("wifimode",rval.wifimode);
	setHTML("wifissid",rval.wifissid);
	setHTML("encryptionmode",rval.encryptionmode);
	setHTML("wirelesschannel",rval.wirelesschannel);
	setHTML("storeinformation","<%:allsize%>:"+rval.storeallsize+"/<%:usedsize%>:"+rval.storeusedsize);
	setHTML("proeManagement",rval.proeManagement== "connected" ? "<%:Connected%>":"<%:msgid "Not connected"%>");
}

var callPath='<%=luci.dispatcher.build_url("admin", "status","getStatInfo")%>';
XHR.get(callPath,null,function(x,rval){
    setStatusValue(rval[0][0]);
});

XHR.poll(10,callPath,null,function(x,rval){
	    setStatusValue(rval[0][0]);
	}
);
</script>
</fieldset>
<%+footer%>